package crmdna.contactdetail;

import crmdna.common.Utils;
import crmdna.contactdetail.ContactDetail.Gender;

public class ContactDetailProp implements Comparable<ContactDetailProp> {
	public String email;
	public String firstName;
	public String lastName;
	public String nickName;
	public String homeAddress;
	public String officeAddress;
	public String homePhone;
	public String officePhone;
	public String mobilePhone;
	public Gender gender;
	public String city;
	public String country;

	public Long centerId;

	public String getName() {
		return Utils.getFullName(firstName, lastName);
	}

	public String getPhoneNos() {
		// TODO add test case

		String phoneNos = "";
		if (mobilePhone != null)
			phoneNos += mobilePhone + " ";

		if (officePhone != null)
			phoneNos += officePhone + " ";

		if (homePhone != null)
			phoneNos += homePhone;

		return phoneNos;
	}

	@Override
	public int compareTo(ContactDetailProp o) {
		if ((firstName != null) && (o.firstName != null))
			return firstName.compareTo(o.firstName);

		if ((email != null) && (o.email != null))
			return email.compareTo(o.email);

		return 0;
	}
}